
<div class="mod-deploy deploy-detail watcher-detail">
  <div class="detail-header">
    <div class="detail-item cluster-name"><em class="item-name">所在集群</em><b class="item-content" ng-bind="config.clusterName" title="{{config.clusterName}}"></b></div><i class="detail-sep"></i>
    <div class="detail-item"><em class="item-name">namespace</em><b class="item-content" ng-bind="config.namespace"></b></div><i class="detail-sep"></i>
    <div class="detail-item"><em class="item-name">部署类型</em><b class="item-content" ng-bind="config.deployTypeShow"></b></div><i class="detail-sep"></i>
    <div class="detail-item"><em class="item-name">上次升级时间</em><b class="item-content" ng-bind="(config.lastUpdateTime | time)"></b></div><i class="detail-sep"></i>
    <div class="detail-item"><em class="item-name">实例个数</em><b class="item-content" ng-bind="config.currentReplicas"></b></div><i class="detail-sep"></i>
    <div class="detail-item"><em class="item-name">当前版本</em><b class="item-content" ng-if="!config.currentVersions||config.currentVersions.length===0">无</b><b class="item-content" ng-repeat="version in config.currentVersions" ng-cloak="ng-cloak">version{{version.version}}</b></div><i class="detail-sep"></i>
    <div class="detail-item"><em class="item-name">状态</em><b class="item-content" ng-switch="config.deploymentStatus"><span class="txt-success" ng-switch-when="RUNNING">运行中</span><span class="txt-error" ng-switch-when="STOP">停止</span><span class="txt-primary" ng-switch-when="DEPLOYING">部署中</span><span class="txt-warning" ng-switch-when="ERROR">异常</span><span class="txt-primary" ng-switch-when="STOPPING">停止中</span><span class="txt-primary" ng-switch-when="UPDATING">升级中</span><span class="txt-primary" ng-switch-when="BACKROLLING">回滚中</span><span class="txt-warning" ng-switch-when="ABORTING">中断中</span><span class="txt-warning" ng-switch-when="BACKROLL_ABORTED">回滚已中断</span><span class="txt-warning" ng-switch-when="UPDATE_ABORTED">升级已中断</span></b></div><i class="detail-sep"></i>
    <div class="deploy-option pull-right tool-align-input" ng-switch="config.deploymentStatus" ng-if="isEdit"><span ng-switch-when="RUNNING">
        <button class="ui-btn ui-btn-bright ui-btn-lg" ng-disabled="isWaitingUpVersion" ng-click="operate('update')" ng-if="!config.stateful">升级/回滚</button>
        <button class="ui-btn ui-btn-bright ui-btn-sm" ng-disabled="isWaitingStop" ng-click="operate('stop')">停止</button></span><span ng-switch-when="STOP">
        <button class="ui-btn ui-btn-bright ui-btn-sm" ng-disabled="isWaitingStart" ng-click="operate('start')">启动</button>
        <button class="ui-btn ui-btn-bright ui-btn-sm" ng-class="{'ui-btn-lg-disabled':!isDelete}" ng-disabled="!isDelete" ng-click="deleteDeploy()">删除</button></span><span ng-if="config.deploymentStatus=='ERROR'||config.deploymentStatus=='BACKROLL_ABORTED'||config.deploymentStatus=='UPDATE_ABORTED'">
        <button class="ui-btn ui-btn-bright ui-btn-sm" ng-if="!config.stateful" ng-disabled="isWaitingRecover" ng-click="operate('recover')">恢复</button>
        <button class="ui-btn ui-btn-bright ui-btn-sm" ng-disabled="isWaitingStop" ng-click="operate('stop')">停止</button></span>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="DEPLOYING" ng-disabled="isWaitingOperation" ng-click="operate('abort','DEPLOYING')" ng-if="config.deploymentType !== 'DAEMONSET'">中断启动</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="UPDATING" ng-disabled="isWaitingOperation" ng-click="operate('abort','UPDATING')" ng-if="config.deploymentType !== 'DAEMONSET'">中断升级</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="BACKROLLING" ng-disabled="isWaitingOperation" ng-click="operate('abort','BACKROLLING')" ng-if="config.deploymentType !== 'DAEMONSET'">中断回滚</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="DEPLOYING" ng-disabled="isWaitingOperation" ng-click="operate('stop')" ng-if="config.deploymentType === 'DAEMONSET'">停止部署</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="UPDATING" ng-disabled="isWaitingOperation" ng-click="operate('stop')" ng-if="config.deploymentType === 'DAEMONSET'">停止部署</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="BACKROLLING" ng-disabled="isWaitingOperation" ng-click="operate('stop')" ng-if="config.deploymentType === 'DAEMONSET'">停止部署</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="UPSCALING" ng-disabled="isWaitingOperation" ng-click="operate('stop')" ng-if="config.deploymentType === 'DAEMONSET'">停止部署</button>
      <button class="ui-btn ui-btn-bright ui-btn-lg" ng-switch-when="DOWNSCALING" ng-disabled="isWaitingOperation" ng-click="operate('stop')" ng-if="config.deploymentType === 'DAEMONSET'">停止部署</button>
    </div>
  </div>
  <loading ng-if="isLoading=(loadingsIns.isLoading||(tabActive[0].active&amp;&amp;deployIns.loadingIns.isLoading &amp;&amp; loadingsIns.isLoading)||(tabActive[1].active&amp;&amp;deployIns.loadingIns.isLoading))"></loading>
  <tabset>
    <tab heading="监听器详情" active="tabActive[0].active" ui-sref="watcherDetail.detail">
      <ng-include src="'index/tpl/tplWatcher/watcherDetail.html'"></ng-include>
    </tab>
    <tab heading="升级" active="tabActive[1].active" ng-if="!config.stateful" ui-sref="watcherDetail.update">
      <ng-include src="'index/tpl/tplWatcher/watcherUpdate.html'"></ng-include>
    </tab>
    <tab heading="事件" active="tabActive[2].active" ng-click="getEvents()" ui-sref="watcherDetail.event">
      <ng-include src="'index/tpl/tplWatcher/watcherEvent.html'"></ng-include>
    </tab>
  </tabset>
</div>
<script type="text/ng-template" id="versionListModal.html">
  <div class="d-modal-header">选择版本</div>
  <form class="modal-body" name="versionFrom" ng-class="{'need-valid':needValid}">
    <ul class="modal-item">
      <li><span class="modal-label">当前版本</span>
        <div style="display:inline-block;"><span style="display:inline-block; height:36px;line-height:36px;" ng-if="!currentVersions||currentVersions.length===0">无</span><span style="display:inline-block; height:36px;line-height:36px;" ng-repeat="version in currentVersions" ng-cloak="ng-cloak">version{{version.version}}</span></div>
      </li>
      <li><span class="modal-label">选择version</span>
        <div class="com-select-con modal-info" select-con="select-con">
          <button class="ui-btn ui-btn-white ui-btn-select"><i class="icon-down"></i>{{versionData.versionId?'version'+versionData.versionId:'选择version'}}</button>
          <ul class="select-list">
            <li class="select-item" ng-repeat="version in versionList"><a ng-click="checkVersion(version.version)" ng-cloak="ng-cloak">version{{version.version}}</a></li>
          </ul>
          <input type="hidden" ng-model="versionData.versionId" name="currentVersionId" required="required"/>
          <div class="txt-error" ng-if="needValid&amp;&amp;versionFrom.currentVersionId.$invalid">请选择版本</div>
        </div>
      </li>
    </ul>
  </form>
  <div class="modal-footer">
    <button class="ui-btn ui-btn-sm ui-btn-white" ng-click="cancel()">取消</button>
    <button class="ui-btn ui-btn-bright ui-btn-sm" ng-click="needValid=true;versionFrom.$valid&amp;&amp;submit()">确定</button>
  </div>
</script>
<script type="text/ng-template" id="createVersionModal.html">
  <div class="d-modal-header">升级版本</div>
  <div class="modal-body" style="display: table;margin: 0 auto;text-align: left;" name="replicasForm">
    <div style="margin-bottom:15px;">成功新建部署版本，本次是否升级？</div>
  </div>
  <div class="modal-footer">
    <button class="ui-btn ui-btn-sm ui-btn-white" ng-click="submitUpdateVersion()">继续升级</button>
    <button class="ui-btn ui-btn-bright ui-btn-sm pull-right" type="submit" ng-click="cancel()">暂不升级</button>
  </div>
</script>